/**
 * jQuery EasyUI 1.4.1
 *
 * Copyright (c) 2009-2014 www.jeasyui.com. All rights reserved.
 *
 * Licensed under the GPL license: http://www.gnu.org/licenses/gpl.txt
 * To use it on other terms please contact us at info@jeasyui.com
 *
 */
(function ($) {
    var _1 = 0;

    function _2(a, o) {
        for (var i = 0, _3 = a.length; i < _3; i++) {
            if (a[i] == o) {
                return i;
            }
        }
        return -1;
    };
    function _4(a, o, id) {
        if (typeof o == "string") {
            for (var i = 0, _5 = a.length; i < _5; i++) {
                if (a[i][o] == id) {
                    a.splice(i, 1);
                    return;
                }
            }
        } else {
            var _6 = _2(a, o);
            if (_6 != -1) {
                a.splice(_6, 1);
            }
        }
    };
    function _7(a, o, r) {
        for (var i = 0, _8 = a.length; i < _8; i++) {
            if (a[i][o] == r[o]) {
                return;
            }
        }
        a.push(r);
    };
    function _9(_a) {
        var _b = $.data(_a, "datagrid");
        var _c = _b.options;
        var _d = _b.panel;
        var dc = _b.dc;
        var ss = null;
        if (_c.sharedStyleSheet) {
            ss = typeof _c.sharedStyleSheet == "boolean" ? "head" : _c.sharedStyleSheet;
        } else {
            ss = _d.closest("div.datagrid-view");
            if (!ss.length) {
                ss = dc.view;
            }
        }
        var cc = $(ss);
        var _e = $.data(cc[0], "ss");
        if (!_e) {
            _e = $.data(cc[0], "ss", {cache: {}, dirty: []});
        }
        return {
            add: function (_f) {
                var ss = ["<style type=\"text/css\" easyui=\"true\">"];
                for (var i = 0; i < _f.length; i++) {
                    _e.cache[_f[i][0]] = {width: _f[i][1]};
                }
                var _10 = 0;
                for (var s in _e.cache) {
                    var _11 = _e.cache[s];
                    _11.index = _10++;
                    ss.push(s + "{width:" + _11.width + "}");
                }
                ss.push("</style>");
                $(ss.join("\n")).appendTo(cc);
                cc.children("style[easyui]:not(:last)").remove();
            }, getRule: function (_12) {
                var _13 = cc.children("style[easyui]:last")[0];
                var _14 = _13.styleSheet ? _13.styleSheet : (_13.sheet || document.styleSheets[document.styleSheets.length - 1]);
                var _15 = _14.cssRules || _14.rules;
                return _15[_12];
            }, set: function (_16, _17) {
                var _18 = _e.cache[_16];
                if (_18) {
                    _18.width = _17;
                    var _19 = this.getRule(_18.index);
                    if (_19) {
                        _19.style["width"] = _17;
                    }
                }
            }, remove: function (_1a) {
                var tmp = [];
                for (var s in _e.cache) {
                    if (s.indexOf(_1a) == -1) {
                        tmp.push([s, _e.cache[s].width]);
                    }
                }
                _e.cache = {};
                this.add(tmp);
            }, dirty: function (_1b) {
                if (_1b) {
                    _e.dirty.push(_1b);
                }
            }, clean: function () {
                for (var i = 0; i < _e.dirty.length; i++) {
                    this.remove(_e.dirty[i]);
                }
                _e.dirty = [];
            }
        };
    };
    function _1c(_1d, _1e) {
        var _1f = $.data(_1d, "datagrid");
        var _20 = _1f.options;
        var _21 = _1f.panel;
        if (_1e) {
            $.extend(_20, _1e);
        }
        if (_20.fit == true) {
            var p = _21.panel("panel").parent();
            _20.width = p.width();
            _20.height = p.height();
        }
        _21.panel("resize", _20);
    };
    function _22(_23) {
        var _24 = $.data(_23, "datagrid");
        var _25 = _24.options;
        var dc = _24.dc;
        var _26 = _24.panel;
        var _27 = _26.width();
        var _28 = _26.height();
        var _29 = dc.view;
        var _2a = dc.view1;
        var _2b = dc.view2;
        var _2c = _2a.children("div.datagrid-header");
        var _2d = _2b.children("div.datagrid-header");
        var _2e = _2c.find("table");
        var _2f = _2d.find("table");
        _29.width(_27);
        var _30 = _2c.children("div.datagrid-header-inner").show();
        _2a.width(_30.find("table").width());
        if (!_25.showHeader) {
            _30.hide();
        }
        _2b.width(_27 - _2a._outerWidth());
        _2a.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_2a.width());
        _2b.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_2b.width());
        var hh;
        _2c.add(_2d).css("height", "");
        _2e.add(_2f).css("height", "");
        hh = Math.max(_2e.height(), _2f.height());
        _2e.add(_2f).height(hh);
        _2c.add(_2d)._outerHeight(hh);
        dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({
            position: "absolute",
            top: dc.header2._outerHeight()
        });
        var _31 = dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
        var _32 = _31 + _2b.children("div.datagrid-header")._outerHeight() + _2b.children("div.datagrid-footer")._outerHeight() + _26.children("div.datagrid-toolbar")._outerHeight();
        _26.children("div.datagrid-pager").each(function () {
            _32 += $(this)._outerHeight();
        });
        var _33 = _26.outerHeight() - _26.height();
        var _34 = _26._size("minHeight") || "";
        var _35 = _26._size("maxHeight") || "";
        _2a.add(_2b).children("div.datagrid-body").css({
            marginTop: _31,
            height: (isNaN(parseInt(_25.height)) ? "" : (_28 - _32)),
            minHeight: (_34 ? _34 - _33 - _32 : ""),
            maxHeight: (_35 ? _35 - _33 - _32 : "")
        });
        _29.height(_2b.height());
    };
    function _36(_37, _38, _39) {
        var _3a = $.data(_37, "datagrid").data.rows;
        var _3b = $.data(_37, "datagrid").options;
        var dc = $.data(_37, "datagrid").dc;
        if (!dc.body1.is(":empty") && (!_3b.nowrap || _3b.autoRowHeight || _39)) {
            if (_38 != undefined) {
                var tr1 = _3b.finder.getTr(_37, _38, "body", 1);
                var tr2 = _3b.finder.getTr(_37, _38, "body", 2);
                _3c(tr1, tr2);
            } else {
                var tr1 = _3b.finder.getTr(_37, 0, "allbody", 1);
                var tr2 = _3b.finder.getTr(_37, 0, "allbody", 2);
                _3c(tr1, tr2);
                if (_3b.showFooter) {
                    var tr1 = _3b.finder.getTr(_37, 0, "allfooter", 1);
                    var tr2 = _3b.finder.getTr(_37, 0, "allfooter", 2);
                    _3c(tr1, tr2);
                }
            }
        }
        _22(_37);
        if (_3b.height == "auto") {
            var _3d = dc.body1.parent();
            var _3e = dc.body2;
            var _3f = _40(_3e);
            var _41 = _3f.height;
            if (_3f.width > _3e.width()) {
                _41 += 18;
            }
            _41 -= parseInt(_3e.css("marginTop")) || 0;
            _3d.height(_41);
            _3e.height(_41);
            dc.view.height(dc.view2.height());
        }
        dc.body2.triggerHandler("scroll");
        function _3c(_42, _43) {
            for (var i = 0; i < _43.length; i++) {
                var tr1 = $(_42[i]);
                var tr2 = $(_43[i]);
                tr1.css("height", "");
                tr2.css("height", "");
                var _44 = Math.max(tr1.height(), tr2.height());
                tr1.css("height", _44);
                tr2.css("height", _44);
            }
        };
        function _40(cc) {
            var _45 = 0;
            var _46 = 0;
            $(cc).children().each(function () {
                var c = $(this);
                if (c.is(":visible")) {
                    _46 += c._outerHeight();
                    if (_45 < c._outerWidth()) {
                        _45 = c._outerWidth();
                    }
                }
            });
            return {width: _45, height: _46};
        };
    };
    function _47(_48, _49) {
        var _4a = $.data(_48, "datagrid");
        var _4b = _4a.options;
        var dc = _4a.dc;
        if (!dc.body2.children("table.datagrid-btable-frozen").length) {
            dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>");
        }
        _4c(true);
        _4c(false);
        _22(_48);
        function _4c(_4d) {
            var _4e = _4d ? 1 : 2;
            var tr = _4b.finder.getTr(_48, _49, "body", _4e);
            (_4d ? dc.body1 : dc.body2).children("table.datagrid-btable-frozen").append(tr);
        };
    };
    function _4f(_50, _51) {
        function _52() {
            var _53 = [];
            var _54 = [];
            $(_50).children("thead").each(function () {
                var opt = $.parser.parseOptions(this, [{frozen: "boolean"}]);
                $(this).find("tr").each(function () {
                    var _55 = [];
                    $(this).find("th").each(function () {
                        var th = $(this);
                        var col = $.extend({}, $.parser.parseOptions(this, ["field", "align", "halign", "order", "width", {
                            sortable: "boolean",
                            checkbox: "boolean",
                            resizable: "boolean",
                            fixed: "boolean"
                        }, {rowspan: "number", colspan: "number"}]), {
                            title: (th.html() || undefined),
                            hidden: (th.attr("hidden") ? true : undefined),
                            formatter: (th.attr("formatter") ? eval(th.attr("formatter")) : undefined),
                            styler: (th.attr("styler") ? eval(th.attr("styler")) : undefined),
                            sorter: (th.attr("sorter") ? eval(th.attr("sorter")) : undefined)
                        });
                        if (col.width && String(col.width).indexOf("%") == -1) {
                            col.width = parseInt(col.width);
                        }
                        if (th.attr("editor")) {
                            var s = $.trim(th.attr("editor"));
                            if (s.substr(0, 1) == "{") {
                                col.editor = eval("(" + s + ")");
                            } else {
                                col.editor = s;
                            }
                        }
                        _55.push(col);
                    });
                    opt.frozen ? _53.push(_55) : _54.push(_55);
                });
            });
            return [_53, _54];
        };
        var _56 = $("<div class=\"datagrid-wrap\">" + "<div class=\"datagrid-view\">" + "<div class=\"datagrid-view1\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\">" + "<div class=\"datagrid-body-inner\"></div>" + "</div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "<div class=\"datagrid-view2\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\"></div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "</div>" + "</div>").insertAfter(_50);
        _56.panel({doSize: false, cls: "datagrid"});
        $(_50).addClass("datagrid-f").hide().appendTo(_56.children("div.datagrid-view"));
        var cc = _52();
        var _57 = _56.children("div.datagrid-view");
        var _58 = _57.children("div.datagrid-view1");
        var _59 = _57.children("div.datagrid-view2");
        return {
            panel: _56,
            frozenColumns: cc[0],
            columns: cc[1],
            dc: {
                view: _57,
                view1: _58,
                view2: _59,
                header1: _58.children("div.datagrid-header").children("div.datagrid-header-inner"),
                header2: _59.children("div.datagrid-header").children("div.datagrid-header-inner"),
                body1: _58.children("div.datagrid-body").children("div.datagrid-body-inner"),
                body2: _59.children("div.datagrid-body"),
                footer1: _58.children("div.datagrid-footer").children("div.datagrid-footer-inner"),
                footer2: _59.children("div.datagrid-footer").children("div.datagrid-footer-inner")
            }
        };
    };
    function _5a(_5b) {
        var _5c = $.data(_5b, "datagrid");
        var _5d = _5c.options;
        var dc = _5c.dc;
        var _5e = _5c.panel;
        _5c.ss = $(_5b).datagrid("createStyleSheet");
        _5e.panel($.extend({}, _5d, {
            id: null, doSize: false, onResize: function (_5f, _60) {
                setTimeout(function () {
                    if ($.data(_5b, "datagrid")) {
                        _22(_5b);
                        _b0(_5b);
                        _5d.onResize.call(_5e, _5f, _60);
                    }
                }, 0);
            }, onExpand: function () {
                _36(_5b);
                _5d.onExpand.call(_5e);
            }
        }));
        _5c.rowIdPrefix = "datagrid-row-r" + (++_1);
        _5c.cellClassPrefix = "datagrid-cell-c" + _1;
        _61(dc.header1, _5d.frozenColumns, true);
        _61(dc.header2, _5d.columns, false);
        _62();
        dc.header1.add(dc.header2).css("display", _5d.showHeader ? "block" : "none");
        dc.footer1.add(dc.footer2).css("display", _5d.showFooter ? "block" : "none");
        if (_5d.toolbar) {
            if ($.isArray(_5d.toolbar)) {
                $("div.datagrid-toolbar", _5e).remove();
                var tb = $("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_5e);
                var tr = tb.find("tr");
                for (var i = 0; i < _5d.toolbar.length; i++) {
                    var btn = _5d.toolbar[i];
                    if (btn == "-") {
                        $("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
                    } else {
                        var td = $("<td></td>").appendTo(tr);
                        var _63 = $("<a href=\"javascript:void(0)\"></a>").appendTo(td);
                        _63[0].onclick = eval(btn.handler || function () {
                            });
                        _63.linkbutton($.extend({}, btn, {plain: true}));
                    }
                }
            } else {
                $(_5d.toolbar).addClass("datagrid-toolbar").prependTo(_5e);
                $(_5d.toolbar).show();
            }
        } else {
            $("div.datagrid-toolbar", _5e).remove();
        }
        $("div.datagrid-pager", _5e).remove();
        if (_5d.pagination) {
            var _64 = $("<div class=\"datagrid-pager\"></div>");
            if (_5d.pagePosition == "bottom") {
                _64.appendTo(_5e);
            } else {
                if (_5d.pagePosition == "top") {
                    _64.addClass("datagrid-pager-top").prependTo(_5e);
                } else {
                    var _65 = $("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_5e);
                    _64.appendTo(_5e);
                    _64 = _64.add(_65);
                }
            }
            _64.pagination({
                total: (_5d.pageNumber * _5d.pageSize),
                pageNumber: _5d.pageNumber,
                pageSize: _5d.pageSize,
                pageList: _5d.pageList,
                onSelectPage: function (_66, _67) {
                    _5d.pageNumber = _66 || 1;
                    _5d.pageSize = _67;
                    _64.pagination("refresh", {pageNumber: _66, pageSize: _67});
                    _ae(_5b);
                }
            });
            _5d.pageSize = _64.pagination("options").pageSize;
        }
        function _61(_68, _69, _6a) {
            if (!_69) {
                return;
            }
            $(_68).show();
            $(_68).empty();
            var _6b = [];
            var _6c = [];
            if (_5d.sortName) {
                _6b = _5d.sortName.split(",");
                _6c = _5d.sortOrder.split(",");
            }
            var t = $("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_68);
            for (var i = 0; i < _69.length; i++) {
                var tr = $("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody", t));
                var _6d = _69[i];
                for (var j = 0; j < _6d.length; j++) {
                    var col = _6d[j];
                    var _6e = "";
                    if (col.rowspan) {
                        _6e += "rowspan=\"" + col.rowspan + "\" ";
                    }
                    if (col.colspan) {
                        _6e += "colspan=\"" + col.colspan + "\" ";
                    }
                    var td = $("<td " + _6e + "></td>").appendTo(tr);
                    if (col.checkbox) {
                        td.attr("field", col.field);
                        $("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\"/>").appendTo(td);
                    } else {
                        if (col.field) {
                            td.attr("field", col.field);
                            td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>");
                            $("span", td).html(col.title);
                            $("span.datagrid-sort-icon", td).html("&nbsp;");
                            var _6f = td.find("div.datagrid-cell");
                            var pos = _2(_6b, col.field);
                            if (pos >= 0) {
                                _6f.addClass("datagrid-sort-" + _6c[pos]);
                            }
                            if (col.resizable == false) {
                                _6f.attr("resizable", "false");
                            }
                            if (col.width) {
                                var _70 = $.parser.parseValue("width", col.width, dc.view, _5d.scrollbarSize);
                                _6f._outerWidth(_70 - 1);
                                col.boxWidth = parseInt(_6f[0].style.width);
                                col.deltaWidth = _70 - col.boxWidth;
                            } else {
                                col.auto = true;
                            }
                            _6f.css("text-align", (col.halign || col.align || ""));
                            col.cellClass = _5c.cellClassPrefix + "-" + col.field.replace(/[\.|\s]/g, "-");
                            _6f.addClass(col.cellClass).css("width", "");
                        } else {
                            $("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
                        }
                    }
                    if (col.hidden) {
                        td.hide();
                    }
                }
            }
            if (_6a && _5d.rownumbers) {
                var td = $("<td rowspan=\"" + _5d.frozenColumns.length + "\"><div class=\"datagrid-header-rownumber\"></div></td>");
                if ($("tr", t).length == 0) {
                    td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody", t));
                } else {
                    td.prependTo($("tr:first", t));
                }
            }
        };
        function _62() {
            var _71 = [];
            var _72 = _73(_5b, true).concat(_73(_5b));
            for (var i = 0; i < _72.length; i++) {
                var col = _74(_5b, _72[i]);
                if (col && !col.checkbox) {
                    _71.push(["." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto"]);
                }
            }
            _5c.ss.add(_71);
            _5c.ss.dirty(_5c.cellSelectorPrefix);
            _5c.cellSelectorPrefix = "." + _5c.cellClassPrefix;
        };
    };
    function _75(_76) {
        var _77 = $.data(_76, "datagrid");
        var _78 = _77.panel;
        var _79 = _77.options;
        var dc = _77.dc;
        var _7a = dc.header1.add(dc.header2);
        _7a.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid", function (e) {
            if (_79.singleSelect && _79.selectOnCheck) {
                return false;
            }
            if ($(this).is(":checked")) {
                _123(_76);
            } else {
                _129(_76);
            }
            e.stopPropagation();
        });
        var _7b = _7a.find("div.datagrid-cell");
        _7b.closest("td").unbind(".datagrid").bind("mouseenter.datagrid", function () {
            if (_77.resizing) {
                return;
            }
            $(this).addClass("datagrid-header-over");
        }).bind("mouseleave.datagrid", function () {
            $(this).removeClass("datagrid-header-over");
        }).bind("contextmenu.datagrid", function (e) {
            var _7c = $(this).attr("field");
            _79.onHeaderContextMenu.call(_76, e, _7c);
        });
        _7b.unbind(".datagrid").bind("click.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            if (e.pageX < p2 && e.pageX > p1) {
                _a2(_76, $(this).parent().attr("field"));
            }
        }).bind("dblclick.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            var _7d = _79.resizeHandle == "right" ? (e.pageX > p2) : (_79.resizeHandle == "left" ? (e.pageX < p1) : (e.pageX < p1 || e.pageX > p2));
            if (_7d) {
                var _7e = $(this).parent().attr("field");
                var col = _74(_76, _7e);
                if (col.resizable == false) {
                    return;
                }
                $(_76).datagrid("autoSizeColumn", _7e);
                col.auto = false;
            }
        });
        var _7f = _79.resizeHandle == "right" ? "e" : (_79.resizeHandle == "left" ? "w" : "e,w");
        _7b.each(function () {
            $(this).resizable({
                handles: _7f,
                disabled: ($(this).attr("resizable") ? $(this).attr("resizable") == "false" : false),
                minWidth: 25,
                onStartResize: function (e) {
                    _77.resizing = true;
                    _7a.css("cursor", $("body").css("cursor"));
                    if (!_77.proxy) {
                        _77.proxy = $("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
                    }
                    _77.proxy.css({left: e.pageX - $(_78).offset().left - 1, display: "none"});
                    setTimeout(function () {
                        if (_77.proxy) {
                            _77.proxy.show();
                        }
                    }, 500);
                },
                onResize: function (e) {
                    _77.proxy.css({left: e.pageX - $(_78).offset().left - 1, display: "block"});
                    return false;
                },
                onStopResize: function (e) {
                    _7a.css("cursor", "");
                    $(this).css("height", "");
                    var _80 = $(this).parent().attr("field");
                    var col = _74(_76, _80);
                    col.width = $(this)._outerWidth();
                    col.boxWidth = col.width - col.deltaWidth;
                    col.auto = undefined;
                    $(this).css("width", "");
                    _d1(_76, _80);
                    _77.proxy.remove();
                    _77.proxy = null;
                    if ($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")) {
                        _22(_76);
                    }
                    _b0(_76);
                    _79.onResizeColumn.call(_76, _80, col.width);
                    setTimeout(function () {
                        _77.resizing = false;
                    }, 0);
                }
            });
        });
        var bb = dc.body1.add(dc.body2);
        bb.unbind();
        for (var _81 in _79.rowEvents) {
            bb.bind(_81, _79.rowEvents[_81]);
        }
        dc.body1.bind("mousewheel DOMMouseScroll", function (e) {
            var e1 = e.originalEvent || window.event;
            var _82 = e1.wheelDelta || e1.detail * (-1);
            var dg = $(e.target).closest("div.datagrid-view").children(".datagrid-f");
            var dc = dg.data("datagrid").dc;
            dc.body2.scrollTop(dc.body2.scrollTop() - _82);
        });
        dc.body2.bind("scroll", function () {
            var b1 = dc.view1.children("div.datagrid-body");
            b1.scrollTop($(this).scrollTop());
            var c1 = dc.body1.children(":first");
            var c2 = dc.body2.children(":first");
            if (c1.length && c2.length) {
                var _83 = c1.offset().top;
                var _84 = c2.offset().top;
                if (_83 != _84) {
                    b1.scrollTop(b1.scrollTop() + _83 - _84);
                }
            }
            dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
            dc.body2.children("table.datagrid-btable-frozen").css("left", -$(this)._scrollLeft());
        });
    };
    function _85(_86) {
        return function (e) {
            var tr = _87(e.target);
            if (!tr) {
                return;
            }
            var _88 = _89(tr);
            if ($.data(_88, "datagrid").resizing) {
                return;
            }
            var _8a = _8b(tr);
            if (_86) {
                _8c(_88, _8a);
            } else {
                var _8d = $.data(_88, "datagrid").options;
                _8d.finder.getTr(_88, _8a).removeClass("datagrid-row-over");
            }
        };
    };
    function _8e(e) {
        var tr = _87(e.target);
        if (!tr) {
            return;
        }
        var _8f = _89(tr);
        var _90 = $.data(_8f, "datagrid").options;
        var _91 = _8b(tr);
        var tt = $(e.target);
        if (tt.parent().hasClass("datagrid-cell-check")) {
            if (_90.singleSelect && _90.selectOnCheck) {
                tt._propAttr("checked", !tt.is(":checked"));
                _92(_8f, _91);
            } else {
                if (tt.is(":checked")) {
                    tt._propAttr("checked", false);
                    _92(_8f, _91);
                } else {
                    tt._propAttr("checked", true);
                    _93(_8f, _91);
                }
            }
        } else {
            var row = _90.finder.getRow(_8f, _91);
            var td = tt.closest("td[field]", tr);
            if (td.length) {
                var _94 = td.attr("field");
                _90.onClickCell.call(_8f, _91, _94, row[_94]);
            }
            if (_90.singleSelect == true) {
                _95(_8f, _91);
            } else {
                if (_90.ctrlSelect) {
                    if (e.ctrlKey) {
                        if (tr.hasClass("datagrid-row-selected")) {
                            _96(_8f, _91);
                        } else {
                            _95(_8f, _91);
                        }
                    } else {
                        if (e.shiftKey) {
                            $(_8f).datagrid("clearSelections");
                            var _97 = Math.min(_90.lastSelectedIndex || 0, _91);
                            var _98 = Math.max(_90.lastSelectedIndex || 0, _91);
                            for (var i = _97; i <= _98; i++) {
                                _95(_8f, i);
                            }
                        } else {
                            $(_8f).datagrid("clearSelections");
                            _95(_8f, _91);
                            _90.lastSelectedIndex = _91;
                        }
                    }
                } else {
                    if (tr.hasClass("datagrid-row-selected")) {
                        _96(_8f, _91);
                    } else {
                        _95(_8f, _91);
                    }
                }
            }
            _90.onClickRow.call(_8f, _91, row);
        }
    };
    function _99(e) {
        var tr = _87(e.target);
        if (!tr) {
            return;
        }
        var _9a = _89(tr);
        var _9b = $.data(_9a, "datagrid").options;
        var _9c = _8b(tr);
        var row = _9b.finder.getRow(_9a, _9c);
        var td = $(e.target).closest("td[field]", tr);
        if (td.length) {
            var _9d = td.attr("field");
            _9b.onDblClickCell.call(_9a, _9c, _9d, row[_9d]);
        }
        _9b.onDblClickRow.call(_9a, _9c, row);
    };
    function _9e(e) {
        var tr = _87(e.target);
        if (!tr) {
            return;
        }
        var _9f = _89(tr);
        var _a0 = $.data(_9f, "datagrid").options;
        var _a1 = _8b(tr);
        var row = _a0.finder.getRow(_9f, _a1);
        _a0.onRowContextMenu.call(_9f, e, _a1, row);
    };
    function _89(t) {
        return $(t).closest("div.datagrid-view").children(".datagrid-f")[0];
    };
    function _87(t) {
        var tr = $(t).closest("tr.datagrid-row");
        if (tr.length && tr.parent().length) {
            return tr;
        } else {
            return undefined;
        }
    };
    function _8b(tr) {
        if (tr.attr("datagrid-row-index")) {
            return parseInt(tr.attr("datagrid-row-index"));
        } else {
            return tr.attr("node-id");
        }
    };
    function _a2(_a3, _a4) {
        var _a5 = $.data(_a3, "datagrid");
        var _a6 = _a5.options;
        _a4 = _a4 || {};
        var _a7 = {sortName: _a6.sortName, sortOrder: _a6.sortOrder};
        if (typeof _a4 == "object") {
            $.extend(_a7, _a4);
        }
        var _a8 = [];
        var _a9 = [];
        if (_a7.sortName) {
            _a8 = _a7.sortName.split(",");
            _a9 = _a7.sortOrder.split(",");
        }
        if (typeof _a4 == "string") {
            var _aa = _a4;
            var col = _74(_a3, _aa);
            if (!col.sortable || _a5.resizing) {
                return;
            }
            var _ab = col.order || "asc";
            var pos = _2(_a8, _aa);
            if (pos >= 0) {
                var _ac = _a9[pos] == "asc" ? "desc" : "asc";
                if (_a6.multiSort && _ac == _ab) {
                    _a8.splice(pos, 1);
                    _a9.splice(pos, 1);
                } else {
                    _a9[pos] = _ac;
                }
            } else {
                if (_a6.multiSort) {
                    _a8.push(_aa);
                    _a9.push(_ab);
                } else {
                    _a8 = [_aa];
                    _a9 = [_ab];
                }
            }
            _a7.sortName = _a8.join(",");
            _a7.sortOrder = _a9.join(",");
        }
        if (_a6.onBeforeSortColumn.call(_a3, _a7.sortName, _a7.sortOrder) == false) {
            return;
        }
        $.extend(_a6, _a7);
        var dc = _a5.dc;
        var _ad = dc.header1.add(dc.header2);
        _ad.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc");
        for (var i = 0; i < _a8.length; i++) {
            var col = _74(_a3, _a8[i]);
            _ad.find("div." + col.cellClass).addClass("datagrid-sort-" + _a9[i]);
        }
        if (_a6.remoteSort) {
            _ae(_a3);
        } else {
            _af(_a3, $(_a3).datagrid("getData"));
        }
        _a6.onSortColumn.call(_a3, _a6.sortName, _a6.sortOrder);
    };
    function _b0(_b1) {
        var _b2 = $.data(_b1, "datagrid");
        var _b3 = _b2.options;
        var dc = _b2.dc;
        var _b4 = dc.view2.children("div.datagrid-header");
        dc.body2.css("overflow-x", "");
        _b5();
        _b6();
        if (_b4.width() >= _b4.find("table").width()) {
            dc.body2.css("overflow-x", "hidden");
        }
        function _b6() {
            if (!_b3.fitColumns) {
                return;
            }
            if (!_b2.leftWidth) {
                _b2.leftWidth = 0;
            }
            var _b7 = 0;
            var cc = [];
            var _b8 = _73(_b1, false);
            for (var i = 0; i < _b8.length; i++) {
                var col = _74(_b1, _b8[i]);
                if (_b9(col)) {
                    _b7 += col.width;
                    cc.push({field: col.field, col: col, addingWidth: 0});
                }
            }
            if (!_b7) {
                return;
            }
            cc[cc.length - 1].addingWidth -= _b2.leftWidth;
            var _ba = _b4.children("div.datagrid-header-inner").show();
            var _bb = _b4.width() - _b4.find("table").width() - _b3.scrollbarSize + _b2.leftWidth;
            var _bc = _bb / _b7;
            if (!_b3.showHeader) {
                _ba.hide();
            }
            for (var i = 0; i < cc.length; i++) {
                var c = cc[i];
                var _bd = parseInt(c.col.width * _bc);
                c.addingWidth += _bd;
                _bb -= _bd;
            }
            cc[cc.length - 1].addingWidth += _bb;
            for (var i = 0; i < cc.length; i++) {
                var c = cc[i];
                if (c.col.boxWidth + c.addingWidth > 0) {
                    c.col.boxWidth += c.addingWidth;
                    c.col.width += c.addingWidth;
                }
            }
            _b2.leftWidth = _bb;
            _d1(_b1);
        };
        function _b5() {
            var _be = false;
            var _bf = _73(_b1, true).concat(_73(_b1, false));
            $.map(_bf, function (_c0) {
                var col = _74(_b1, _c0);
                if (String(col.width || "").indexOf("%") >= 0) {
                    var _c1 = $.parser.parseValue("width", col.width, dc.view, _b3.scrollbarSize) - col.deltaWidth;
                    if (_c1 > 0) {
                        col.boxWidth = _c1;
                        _be = true;
                    }
                }
            });
            if (_be) {
                _d1(_b1);
            }
        };
        function _b9(col) {
            if (String(col.width || "").indexOf("%") >= 0) {
                return false;
            }
            if (!col.hidden && !col.checkbox && !col.auto && !col.fixed) {
                return true;
            }
        };
    };
    function _c2(_c3, _c4) {
        var _c5 = $.data(_c3, "datagrid");
        var _c6 = _c5.options;
        var dc = _c5.dc;
        var tmp = $("<div class=\"datagrid-cell\" style=\"position:absolute;left:-9999px\"></div>").appendTo("body");
        if (_c4) {
            _1c(_c4);
            if (_c6.fitColumns) {
                _22(_c3);
                _b0(_c3);
            }
        } else {
            var _c7 = false;
            var _c8 = _73(_c3, true).concat(_73(_c3, false));
            for (var i = 0; i < _c8.length; i++) {
                var _c4 = _c8[i];
                var col = _74(_c3, _c4);
                if (col.auto) {
                    _1c(_c4);
                    _c7 = true;
                }
            }
            if (_c7 && _c6.fitColumns) {
                _22(_c3);
                _b0(_c3);
            }
        }
        tmp.remove();
        function _1c(_c9) {
            var _ca = dc.view.find("div.datagrid-header td[field=\"" + _c9 + "\"] div.datagrid-cell");
            _ca.css("width", "");
            var col = $(_c3).datagrid("getColumnOption", _c9);
            col.width = undefined;
            col.boxWidth = undefined;
            col.auto = true;
            $(_c3).datagrid("fixColumnSize", _c9);
            var _cb = Math.max(_cc("header"), _cc("allbody"), _cc("allfooter")) + 1;
            _ca._outerWidth(_cb - 1);
            col.width = _cb;
            col.boxWidth = parseInt(_ca[0].style.width);
            col.deltaWidth = _cb - col.boxWidth;
            _ca.css("width", "");
            $(_c3).datagrid("fixColumnSize", _c9);
            _c6.onResizeColumn.call(_c3, _c9, col.width);
            function _cc(_cd) {
                var _ce = 0;
                if (_cd == "header") {
                    _ce = _cf(_ca);
                } else {
                    _c6.finder.getTr(_c3, 0, _cd).find("td[field=\"" + _c9 + "\"] div.datagrid-cell").each(function () {
                        var w = _cf($(this));
                        if (_ce < w) {
                            _ce = w;
                        }
                    });
                }
                return _ce;
                function _cf(_d0) {
                    return _d0.is(":visible") ? _d0._outerWidth() : tmp.html(_d0.html())._outerWidth();
                };
            };
        };
    };
    function _d1(_d2, _d3) {
        var _d4 = $.data(_d2, "datagrid");
        var _d5 = _d4.options;
        var dc = _d4.dc;
        var _d6 = dc.view.find("table.datagrid-btable,table.datagrid-ftable");
        _d6.css("table-layout", "fixed");
        if (_d3) {
            fix(_d3);
        } else {
            var ff = _73(_d2, true).concat(_73(_d2, false));
            for (var i = 0; i < ff.length; i++) {
                fix(ff[i]);
            }
        }
        _d6.css("table-layout", "auto");
        _d7(_d2);
        _36(_d2);
        _d8(_d2);
        function fix(_d9) {
            var col = _74(_d2, _d9);
            if (col.cellClass) {
                _d4.ss.set("." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto");
            }
        };
    };
    function _d7(_da) {
        var dc = $.data(_da, "datagrid").dc;
        dc.view.find("td.datagrid-td-merged").each(function () {
            var td = $(this);
            var _db = td.attr("colspan") || 1;
            var col = _74(_da, td.attr("field"));
            var _dc = col.boxWidth + col.deltaWidth - 1;
            for (var i = 1; i < _db; i++) {
                td = td.next();
                col = _74(_da, td.attr("field"));
                _dc += col.boxWidth + col.deltaWidth;
            }
            $(this).children("div.datagrid-cell")._outerWidth(_dc);
        });
    };
    function _d8(_dd) {
        var dc = $.data(_dd, "datagrid").dc;
        dc.view.find("div.datagrid-editable").each(function () {
            var _de = $(this);
            var _df = _de.parent().attr("field");
            var col = $(_dd).datagrid("getColumnOption", _df);
            _de._outerWidth(col.boxWidth + col.deltaWidth - 1);
            var ed = $.data(this, "datagrid.editor");
            if (ed.actions.resize) {
                ed.actions.resize(ed.target, _de.width());
            }
        });
    };
    function _74(_e0, _e1) {
        function _e2(_e3) {
            if (_e3) {
                for (var i = 0; i < _e3.length; i++) {
                    var cc = _e3[i];
                    for (var j = 0; j < cc.length; j++) {
                        var c = cc[j];
                        if (c.field == _e1) {
                            return c;
                        }
                    }
                }
            }
            return null;
        };
        var _e4 = $.data(_e0, "datagrid").options;
        var col = _e2(_e4.columns);
        if (!col) {
            col = _e2(_e4.frozenColumns);
        }
        return col;
    };
    function _73(_e5, _e6) {
        var _e7 = $.data(_e5, "datagrid").options;
        var _e8 = (_e6 == true) ? (_e7.frozenColumns || [[]]) : _e7.columns;
        if (_e8.length == 0) {
            return [];
        }
        var aa = [];
        var _e9 = _ea();
        for (var i = 0; i < _e8.length; i++) {
            aa[i] = new Array(_e9);
        }
        for (var _eb = 0; _eb < _e8.length; _eb++) {
            $.map(_e8[_eb], function (col) {
                var _ec = _ed(aa[_eb]);
                if (_ec >= 0) {
                    var _ee = col.field || "";
                    for (var c = 0; c < (col.colspan || 1); c++) {
                        for (var r = 0; r < (col.rowspan || 1); r++) {
                            aa[_eb + r][_ec] = _ee;
                        }
                        _ec++;
                    }
                }
            });
        }
        return aa[aa.length - 1];
        function _ea() {
            var _ef = 0;
            $.map(_e8[0], function (col) {
                _ef += col.colspan || 1;
            });
            return _ef;
        };
        function _ed(a) {
            for (var i = 0; i < a.length; i++) {
                if (a[i] == undefined) {
                    return i;
                }
            }
            return -1;
        };
    };
    function _af(_f0, _f1) {
        var _f2 = $.data(_f0, "datagrid");
        var _f3 = _f2.options;
        var dc = _f2.dc;
        _f1 = _f3.loadFilter.call(_f0, _f1);
        _f1.total = parseInt(_f1.total);
        _f2.data = _f1;
        if (_f1.footer) {
            _f2.footer = _f1.footer;
        }
        if (!_f3.remoteSort && _f3.sortName) {
            var _f4 = _f3.sortName.split(",");
            var _f5 = _f3.sortOrder.split(",");
            _f1.rows.sort(function (r1, r2) {
                var r = 0;
                for (var i = 0; i < _f4.length; i++) {
                    var sn = _f4[i];
                    var so = _f5[i];
                    var col = _74(_f0, sn);
                    var _f6 = col.sorter || function (a, b) {
                            return a == b ? 0 : (a > b ? 1 : -1);
                        };
                    r = _f6(r1[sn], r2[sn]) * (so == "asc" ? 1 : -1);
                    if (r != 0) {
                        return r;
                    }
                }
                return r;
            });
        }
        if (_f3.view.onBeforeRender) {
            _f3.view.onBeforeRender.call(_f3.view, _f0, _f1.rows);
        }
        _f3.view.render.call(_f3.view, _f0, dc.body2, false);
        _f3.view.render.call(_f3.view, _f0, dc.body1, true);
        if (_f3.showFooter) {
            _f3.view.renderFooter.call(_f3.view, _f0, dc.footer2, false);
            _f3.view.renderFooter.call(_f3.view, _f0, dc.footer1, true);
        }
        if (_f3.view.onAfterRender) {
            _f3.view.onAfterRender.call(_f3.view, _f0);
        }
        _f2.ss.clean();
        var _f7 = $(_f0).datagrid("getPager");
        if (_f7.length) {
            var _f8 = _f7.pagination("options");
            if (_f8.total != _f1.total) {
                _f7.pagination("refresh", {total: _f1.total});
                if (_f3.pageNumber != _f8.pageNumber && _f8.pageNumber > 0) {
                    _f3.pageNumber = _f8.pageNumber;
                    _ae(_f0);
                }
            }
        }
        _36(_f0);
        dc.body2.triggerHandler("scroll");
        $(_f0).datagrid("setSelectionState");
        $(_f0).datagrid("autoSizeColumn");
        _f3.onLoadSuccess.call(_f0, _f1);
    };
    function _f9(_fa) {
        var _fb = $.data(_fa, "datagrid");
        var _fc = _fb.options;
        var dc = _fb.dc;
        dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked", false);
        if (_fc.idField) {
            var _fd = $.data(_fa, "treegrid") ? true : false;
            var _fe = _fc.onSelect;
            var _ff = _fc.onCheck;
            _fc.onSelect = _fc.onCheck = function () {
            };
            var rows = _fc.finder.getRows(_fa);
            for (var i = 0; i < rows.length; i++) {
                var row = rows[i];
                var _100 = _fd ? row[_fc.idField] : i;
                if (_101(_fb.selectedRows, row)) {
                    _95(_fa, _100, true);
                }
                if (_101(_fb.checkedRows, row)) {
                    _92(_fa, _100, true);
                }
            }
            _fc.onSelect = _fe;
            _fc.onCheck = _ff;
        }
        function _101(a, r) {
            for (var i = 0; i < a.length; i++) {
                if (a[i][_fc.idField] == r[_fc.idField]) {
                    a[i] = r;
                    return true;
                }
            }
            return false;
        };
    };
    function _102(_103, row) {
        var _104 = $.data(_103, "datagrid");
        var opts = _104.options;
        var rows = _104.data.rows;
        if (typeof row == "object") {
            return _2(rows, row);
        } else {
            for (var i = 0; i < rows.length; i++) {
                if (rows[i][opts.idField] == row) {
                    return i;
                }
            }
            return -1;
        }
    };
    function _105(_106) {
        var _107 = $.data(_106, "datagrid");
        var opts = _107.options;
        var data = _107.data;
        if (opts.idField) {
            return _107.selectedRows;
        } else {
            var rows = [];
            opts.finder.getTr(_106, "", "selected", 2).each(function () {
                rows.push(opts.finder.getRow(_106, $(this)));
            });
            return rows;
        }
    };
    function _108(_109) {
        var _10a = $.data(_109, "datagrid");
        var opts = _10a.options;
        if (opts.idField) {
            return _10a.checkedRows;
        } else {
            var rows = [];
            opts.finder.getTr(_109, "", "checked", 2).each(function () {
                rows.push(opts.finder.getRow(_109, $(this)));
            });
            return rows;
        }
    };
    function _10b(_10c, _10d) {
        var _10e = $.data(_10c, "datagrid");
        var dc = _10e.dc;
        var opts = _10e.options;
        var tr = opts.finder.getTr(_10c, _10d);
        if (tr.length) {
            if (tr.closest("table").hasClass("datagrid-btable-frozen")) {
                return;
            }
            var _10f = dc.view2.children("div.datagrid-header")._outerHeight();
            var _110 = dc.body2;
            var _111 = _110.outerHeight(true) - _110.outerHeight();
            var top = tr.position().top - _10f - _111;
            if (top < 0) {
                _110.scrollTop(_110.scrollTop() + top);
            } else {
                if (top + tr._outerHeight() > _110.height() - 18) {
                    _110.scrollTop(_110.scrollTop() + top + tr._outerHeight() - _110.height() + 18);
                }
            }
        }
    };
    function _8c(_112, _113) {
        var _114 = $.data(_112, "datagrid");
        var opts = _114.options;
        opts.finder.getTr(_112, _114.highlightIndex).removeClass("datagrid-row-over");
        opts.finder.getTr(_112, _113).addClass("datagrid-row-over");
        _114.highlightIndex = _113;
    };
    function _95(_115, _116, _117) {
        var _118 = $.data(_115, "datagrid");
        var opts = _118.options;
        var row = opts.finder.getRow(_115, _116);
        if (opts.onBeforeSelect.call(_115, _116, row) == false) {
            return;
        }
        if (opts.singleSelect) {
            _119(_115, true);
            _118.selectedRows = [];
        }
        if (!_117 && opts.checkOnSelect) {
            _92(_115, _116, true);
        }
        if (opts.idField) {
            _7(_118.selectedRows, opts.idField, row);
        }
        opts.finder.getTr(_115, _116).addClass("datagrid-row-selected");
        opts.onSelect.call(_115, _116, row);
        _10b(_115, _116);
    };
    function _96(_11a, _11b, _11c) {
        var _11d = $.data(_11a, "datagrid");
        var dc = _11d.dc;
        var opts = _11d.options;
        var row = opts.finder.getRow(_11a, _11b);
        if (opts.onBeforeUnselect.call(_11a, _11b, row) == false) {
            return;
        }
        if (!_11c && opts.checkOnSelect) {
            _93(_11a, _11b, true);
        }
        opts.finder.getTr(_11a, _11b).removeClass("datagrid-row-selected");
        if (opts.idField) {
            _4(_11d.selectedRows, opts.idField, row[opts.idField]);
        }
        opts.onUnselect.call(_11a, _11b, row);
    };
    function _11e(_11f, _120) {
        var _121 = $.data(_11f, "datagrid");
        var opts = _121.options;
        var rows = opts.finder.getRows(_11f);
        var _122 = $.data(_11f, "datagrid").selectedRows;
        if (!_120 && opts.checkOnSelect) {
            _123(_11f, true);
        }
        opts.finder.getTr(_11f, "", "allbody").addClass("datagrid-row-selected");
        if (opts.idField) {
            for (var _124 = 0; _124 < rows.length; _124++) {
                _7(_122, opts.idField, rows[_124]);
            }
        }
        opts.onSelectAll.call(_11f, rows);
    };
    function _119(_125, _126) {
        var _127 = $.data(_125, "datagrid");
        var opts = _127.options;
        var rows = opts.finder.getRows(_125);
        var _128 = $.data(_125, "datagrid").selectedRows;
        if (!_126 && opts.checkOnSelect) {
            _129(_125, true);
        }
        opts.finder.getTr(_125, "", "selected").removeClass("datagrid-row-selected");
        if (opts.idField) {
            for (var _12a = 0; _12a < rows.length; _12a++) {
                _4(_128, opts.idField, rows[_12a][opts.idField]);
            }
        }
        opts.onUnselectAll.call(_125, rows);
    };
    function _92(_12b, _12c, _12d) {
        var _12e = $.data(_12b, "datagrid");
        var opts = _12e.options;
        var row = opts.finder.getRow(_12b, _12c);
        if (opts.onBeforeCheck.call(_12b, _12c, row) == false) {
            return;
        }
        if (opts.singleSelect && opts.selectOnCheck) {
            _129(_12b, true);
            _12e.checkedRows = [];
        }
        if (!_12d && opts.selectOnCheck) {
            _95(_12b, _12c, true);
        }
        var tr = opts.finder.getTr(_12b, _12c).addClass("datagrid-row-checked");
        tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true);
        tr = opts.finder.getTr(_12b, "", "checked", 2);
        if (tr.length == opts.finder.getRows(_12b).length) {
            var dc = _12e.dc;
            dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked", true);
        }
        if (opts.idField) {
            _7(_12e.checkedRows, opts.idField, row);
        }
        opts.onCheck.call(_12b, _12c, row);
    };
    function _93(_12f, _130, _131) {
        var _132 = $.data(_12f, "datagrid");
        var opts = _132.options;
        var row = opts.finder.getRow(_12f, _130);
        if (opts.onBeforeUncheck.call(_12f, _130, row) == false) {
            return;
        }
        if (!_131 && opts.selectOnCheck) {
            _96(_12f, _130, true);
        }
        var tr = opts.finder.getTr(_12f, _130).removeClass("datagrid-row-checked");
        tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", false);
        var dc = _132.dc;
        var _133 = dc.header1.add(dc.header2);
        _133.find("input[type=checkbox]")._propAttr("checked", false);
        if (opts.idField) {
            _4(_132.checkedRows, opts.idField, row[opts.idField]);
        }
        opts.onUncheck.call(_12f, _130, row);
    };
    function _123(_134, _135) {
        var _136 = $.data(_134, "datagrid");
        var opts = _136.options;
        var rows = opts.finder.getRows(_134);
        if (!_135 && opts.selectOnCheck) {
            _11e(_134, true);
        }
        var dc = _136.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_134, "", "allbody").addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", true);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _7(_136.checkedRows, opts.idField, rows[i]);
            }
        }
        opts.onCheckAll.call(_134, rows);
    };
    function _129(_137, _138) {
        var _139 = $.data(_137, "datagrid");
        var opts = _139.options;
        var rows = opts.finder.getRows(_137);
        if (!_138 && opts.selectOnCheck) {
            _119(_137, true);
        }
        var dc = _139.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_137, "", "checked").removeClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", false);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _4(_139.checkedRows, opts.idField, rows[i][opts.idField]);
            }
        }
        opts.onUncheckAll.call(_137, rows);
    };
    function _13a(_13b, _13c) {
        var opts = $.data(_13b, "datagrid").options;
        var tr = opts.finder.getTr(_13b, _13c);
        var row = opts.finder.getRow(_13b, _13c);
        if (tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (opts.onBeforeEdit.call(_13b, _13c, row) == false) {
            return;
        }
        tr.addClass("datagrid-row-editing");
        _13d(_13b, _13c);
        _d8(_13b);
        tr.find("div.datagrid-editable").each(function () {
            var _13e = $(this).parent().attr("field");
            var ed = $.data(this, "datagrid.editor");
            ed.actions.setValue(ed.target, row[_13e]);
        });
        _13f(_13b, _13c);
        opts.onBeginEdit.call(_13b, _13c, row);
    };
    function _140(_141, _142, _143) {
        var _144 = $.data(_141, "datagrid");
        var opts = _144.options;
        var _145 = _144.updatedRows;
        var _146 = _144.insertedRows;
        var tr = opts.finder.getTr(_141, _142);
        var row = opts.finder.getRow(_141, _142);
        if (!tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (!_143) {
            if (!_13f(_141, _142)) {
                return;
            }
            var _147 = false;
            var _148 = {};
            tr.find("div.datagrid-editable").each(function () {
                var _149 = $(this).parent().attr("field");
                var ed = $.data(this, "datagrid.editor");
                var t = $(ed.target);
                var _14a = t.data("textbox") ? t.textbox("textbox") : t;
                _14a.triggerHandler("blur");
                var _14b = ed.actions.getValue(ed.target);
                if (row[_149] != _14b) {
                    row[_149] = _14b;
                    _147 = true;
                    _148[_149] = _14b;
                }
            });
            if (_147) {
                if (_2(_146, row) == -1) {
                    if (_2(_145, row) == -1) {
                        _145.push(row);
                    }
                }
            }
            opts.onEndEdit.call(_141, _142, row, _148);
        }
        tr.removeClass("datagrid-row-editing");
        _14c(_141, _142);
        $(_141).datagrid("refreshRow", _142);
        if (!_143) {
            opts.onAfterEdit.call(_141, _142, row, _148);
        } else {
            opts.onCancelEdit.call(_141, _142, row);
        }
    };
    function _14d(_14e, _14f) {
        var opts = $.data(_14e, "datagrid").options;
        var tr = opts.finder.getTr(_14e, _14f);
        var _150 = [];
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                _150.push(ed);
            }
        });
        return _150;
    };
    function _151(_152, _153) {
        var _154 = _14d(_152, _153.index != undefined ? _153.index : _153.id);
        for (var i = 0; i < _154.length; i++) {
            if (_154[i].field == _153.field) {
                return _154[i];
            }
        }
        return null;
    };
    function _13d(_155, _156) {
        var opts = $.data(_155, "datagrid").options;
        var tr = opts.finder.getTr(_155, _156);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-cell");
            var _157 = $(this).attr("field");
            var col = _74(_155, _157);
            if (col && col.editor) {
                var _158, _159;
                if (typeof col.editor == "string") {
                    _158 = col.editor;
                } else {
                    _158 = col.editor.type;
                    _159 = col.editor.options;
                }
                var _15a = opts.editors[_158];
                if (_15a) {
                    var _15b = cell.html();
                    var _15c = cell._outerWidth();
                    cell.addClass("datagrid-editable");
                    cell._outerWidth(_15c);
                    cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
                    cell.children("table").bind("click dblclick contextmenu", function (e) {
                        e.stopPropagation();
                    });
                    $.data(cell[0], "datagrid.editor", {
                        actions: _15a,
                        target: _15a.init(cell.find("td"), _159),
                        field: _157,
                        type: _158,
                        oldHtml: _15b
                    });
                }
            }
        });
        _36(_155, _156, true);
    };
    function _14c(_15d, _15e) {
        var opts = $.data(_15d, "datagrid").options;
        var tr = opts.finder.getTr(_15d, _15e);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                if (ed.actions.destroy) {
                    ed.actions.destroy(ed.target);
                }
                cell.html(ed.oldHtml);
                $.removeData(cell[0], "datagrid.editor");
                cell.removeClass("datagrid-editable");
                cell.css("width", "");
            }
        });
    };
    function _13f(_15f, _160) {
        var tr = $.data(_15f, "datagrid").options.finder.getTr(_15f, _160);
        if (!tr.hasClass("datagrid-row-editing")) {
            return true;
        }
        var vbox = tr.find(".validatebox-text");
        vbox.validatebox("validate");
        vbox.trigger("mouseleave");
        var _161 = tr.find(".validatebox-invalid");
        return _161.length == 0;
    };
    function _162(_163, _164) {
        var _165 = $.data(_163, "datagrid").insertedRows;
        var _166 = $.data(_163, "datagrid").deletedRows;
        var _167 = $.data(_163, "datagrid").updatedRows;
        if (!_164) {
            var rows = [];
            rows = rows.concat(_165);
            rows = rows.concat(_166);
            rows = rows.concat(_167);
            return rows;
        } else {
            if (_164 == "inserted") {
                return _165;
            } else {
                if (_164 == "deleted") {
                    return _166;
                } else {
                    if (_164 == "updated") {
                        return _167;
                    }
                }
            }
        }
        return [];
    };
    function _168(_169, _16a) {
        var _16b = $.data(_169, "datagrid");
        var opts = _16b.options;
        var data = _16b.data;
        var _16c = _16b.insertedRows;
        var _16d = _16b.deletedRows;
        $(_169).datagrid("cancelEdit", _16a);
        var row = opts.finder.getRow(_169, _16a);
        if (_2(_16c, row) >= 0) {
            _4(_16c, row);
        } else {
            _16d.push(row);
        }
        _4(_16b.selectedRows, opts.idField, row[opts.idField]);
        _4(_16b.checkedRows, opts.idField, row[opts.idField]);
        opts.view.deleteRow.call(opts.view, _169, _16a);
        if (opts.height == "auto") {
            _36(_169);
        }
        $(_169).datagrid("getPager").pagination("refresh", {total: data.total});
    };
    function _16e(_16f, _170) {
        var data = $.data(_16f, "datagrid").data;
        var view = $.data(_16f, "datagrid").options.view;
        var _171 = $.data(_16f, "datagrid").insertedRows;
        view.insertRow.call(view, _16f, _170.index, _170.row);
        _171.push(_170.row);
        $(_16f).datagrid("getPager").pagination("refresh", {total: data.total});
    };
    function _172(_173, row) {
        var data = $.data(_173, "datagrid").data;
        var view = $.data(_173, "datagrid").options.view;
        var _174 = $.data(_173, "datagrid").insertedRows;
        view.insertRow.call(view, _173, null, row);
        _174.push(row);
        $(_173).datagrid("getPager").pagination("refresh", {total: data.total});
    };
    function _175(_176) {
        var _177 = $.data(_176, "datagrid");
        var data = _177.data;
        var rows = data.rows;
        var _178 = [];
        for (var i = 0; i < rows.length; i++) {
            _178.push($.extend({}, rows[i]));
        }
        _177.originalRows = _178;
        _177.updatedRows = [];
        _177.insertedRows = [];
        _177.deletedRows = [];
    };
    function _179(_17a) {
        var data = $.data(_17a, "datagrid").data;
        var ok = true;
        for (var i = 0, len = data.rows.length; i < len; i++) {
            if (_13f(_17a, i)) {
                $(_17a).datagrid("endEdit", i);
            } else {
                ok = false;
            }
        }
        if (ok) {
            _175(_17a);
        }
    };
    function _17b(_17c) {
        var _17d = $.data(_17c, "datagrid");
        var opts = _17d.options;
        var _17e = _17d.originalRows;
        var _17f = _17d.insertedRows;
        var _180 = _17d.deletedRows;
        var _181 = _17d.selectedRows;
        var _182 = _17d.checkedRows;
        var data = _17d.data;

        function _183(a) {
            var ids = [];
            for (var i = 0; i < a.length; i++) {
                ids.push(a[i][opts.idField]);
            }
            return ids;
        };
        function _184(ids, _185) {
            for (var i = 0; i < ids.length; i++) {
                var _186 = _102(_17c, ids[i]);
                if (_186 >= 0) {
                    (_185 == "s" ? _95 : _92)(_17c, _186, true);
                }
            }
        };
        for (var i = 0; i < data.rows.length; i++) {
            $(_17c).datagrid("cancelEdit", i);
        }
        var _187 = _183(_181);
        var _188 = _183(_182);
        _181.splice(0, _181.length);
        _182.splice(0, _182.length);
        data.total += _180.length - _17f.length;
        data.rows = _17e;
        _af(_17c, data);
        _184(_187, "s");
        _184(_188, "c");
        _175(_17c);
    };
    function _ae(_189, _18a) {
        var opts = $.data(_189, "datagrid").options;
        if (_18a) {
            opts.queryParams = _18a;
        }
        var _18b = $.extend({}, opts.queryParams);
        if (opts.pagination) {
            $.extend(_18b, {page: opts.pageNumber || 1, rows: opts.pageSize});
        }
        if (opts.sortName) {
            $.extend(_18b, {sort: opts.sortName, order: opts.sortOrder});
        }
        if (opts.onBeforeLoad.call(_189, _18b) == false) {
            return;
        }
        $(_189).datagrid("loading");
        setTimeout(function () {
            _18c();
        }, 0);
        function _18c() {
            var _18d = opts.loader.call(_189, _18b, function (data) {
                setTimeout(function () {
                    $(_189).datagrid("loaded");
                }, 0);
                _af(_189, data);
                setTimeout(function () {
                    _175(_189);
                }, 0);
            }, function () {
                setTimeout(function () {
                    $(_189).datagrid("loaded");
                }, 0);
                opts.onLoadError.apply(_189, arguments);
            });
            if (_18d == false) {
                $(_189).datagrid("loaded");
            }
        };
    };
    function _18e(_18f, _190) {
        var opts = $.data(_18f, "datagrid").options;
        _190.type = _190.type || "body";
        _190.rowspan = _190.rowspan || 1;
        _190.colspan = _190.colspan || 1;
        if (_190.rowspan == 1 && _190.colspan == 1) {
            return;
        }
        var tr = opts.finder.getTr(_18f, (_190.index != undefined ? _190.index : _190.id), _190.type);
        if (!tr.length) {
            return;
        }
        var td = tr.find("td[field=\"" + _190.field + "\"]");
        td.attr("rowspan", _190.rowspan).attr("colspan", _190.colspan);
        td.addClass("datagrid-td-merged");
        _191(td.next(), _190.colspan - 1);
        for (var i = 1; i < _190.rowspan; i++) {
            tr = tr.next();
            if (!tr.length) {
                break;
            }
            td = tr.find("td[field=\"" + _190.field + "\"]");
            _191(td, _190.colspan);
        }
        _d7(_18f);
        function _191(td, _192) {
            for (var i = 0; i < _192; i++) {
                td.hide();
                td = td.next();
            }
        };
    };
    $.fn.datagrid = function (_193, _194) {
        if (typeof _193 == "string") {
            return $.fn.datagrid.methods[_193](this, _194);
        }
        _193 = _193 || {};
        return this.each(function () {
            var _195 = $.data(this, "datagrid");
            var opts;
            if (_195) {
                opts = $.extend(_195.options, _193);
                _195.options = opts;
            } else {
                opts = $.extend({}, $.extend({}, $.fn.datagrid.defaults, {queryParams: {}}), $.fn.datagrid.parseOptions(this), _193);
                $(this).css("width", "").css("height", "");
                var _196 = _4f(this, opts.rownumbers);
                if (!opts.columns) {
                    opts.columns = _196.columns;
                }
                if (!opts.frozenColumns) {
                    opts.frozenColumns = _196.frozenColumns;
                }
                opts.columns = $.extend(true, [], opts.columns);
                opts.frozenColumns = $.extend(true, [], opts.frozenColumns);
                opts.view = $.extend({}, opts.view);
                $.data(this, "datagrid", {
                    options: opts,
                    panel: _196.panel,
                    dc: _196.dc,
                    ss: null,
                    selectedRows: [],
                    checkedRows: [],
                    data: {total: 0, rows: []},
                    originalRows: [],
                    updatedRows: [],
                    insertedRows: [],
                    deletedRows: []
                });
            }
            _5a(this);
            _75(this);
            _1c(this);
            if (opts.data) {
                _af(this, opts.data);
                _175(this);
            } else {
                var data = $.fn.datagrid.parseData(this);
                if (data.total > 0) {
                    _af(this, data);
                    _175(this);
                }
            }
            _ae(this);
        });
    };
    function _197(_198) {
        var _199 = {};
        $.map(_198, function (name) {
            _199[name] = _19a(name);
        });
        return _199;
        function _19a(name) {
            function isA(_19b) {
                return $.data($(_19b)[0], name) != undefined;
            };
            return {
                init: function (_19c, _19d) {
                    var _19e = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_19c);
                    if (_19e[name] && name != "text") {
                        return _19e[name](_19d);
                    } else {
                        return _19e;
                    }
                }, destroy: function (_19f) {
                    if (isA(_19f, name)) {
                        $(_19f)[name]("destroy");
                    }
                }, getValue: function (_1a0) {
                    if (isA(_1a0, name)) {
                        var opts = $(_1a0)[name]("options");
                        if (opts.multiple) {
                            return $(_1a0)[name]("getValues").join(opts.separator);
                        } else {
                            return $(_1a0)[name]("getValue");
                        }
                    } else {
                        return $(_1a0).val();
                    }
                }, setValue: function (_1a1, _1a2) {
                    if (isA(_1a1, name)) {
                        var opts = $(_1a1)[name]("options");
                        if (opts.multiple) {
                            if (_1a2) {
                                $(_1a1)[name]("setValues", _1a2.split(opts.separator));
                            } else {
                                $(_1a1)[name]("clear");
                            }
                        } else {
                            $(_1a1)[name]("setValue", _1a2);
                        }
                    } else {
                        $(_1a1).val(_1a2);
                    }
                }, resize: function (_1a3, _1a4) {
                    if (isA(_1a3, name)) {
                        $(_1a3)[name]("resize", _1a4);
                    } else {
                        $(_1a3)._outerWidth(_1a4)._outerHeight(22);
                    }
                }
            };
        };
    };
    var _1a5 = $.extend({}, _197(["text", "textbox", "numberbox", "numberspinner", "combobox", "combotree", "combogrid", "datebox", "datetimebox", "timespinner", "datetimespinner"]), {
        textarea: {
            init: function (_1a6, _1a7) {
                var _1a8 = $("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_1a6);
                return _1a8;
            }, getValue: function (_1a9) {
                return $(_1a9).val();
            }, setValue: function (_1aa, _1ab) {
                $(_1aa).val(_1ab);
            }, resize: function (_1ac, _1ad) {
                $(_1ac)._outerWidth(_1ad);
            }
        }, checkbox: {
            init: function (_1ae, _1af) {
                var _1b0 = $("<input type=\"checkbox\">").appendTo(_1ae);
                _1b0.val(_1af.on);
                _1b0.attr("offval", _1af.off);
                return _1b0;
            }, getValue: function (_1b1) {
                if ($(_1b1).is(":checked")) {
                    return $(_1b1).val();
                } else {
                    return $(_1b1).attr("offval");
                }
            }, setValue: function (_1b2, _1b3) {
                var _1b4 = false;
                if ($(_1b2).val() == _1b3) {
                    _1b4 = true;
                }
                $(_1b2)._propAttr("checked", _1b4);
            }
        }, validatebox: {
            init: function (_1b5, _1b6) {
                var _1b7 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_1b5);
                _1b7.validatebox(_1b6);
                return _1b7;
            }, destroy: function (_1b8) {
                $(_1b8).validatebox("destroy");
            }, getValue: function (_1b9) {
                return $(_1b9).val();
            }, setValue: function (_1ba, _1bb) {
                $(_1ba).val(_1bb);
            }, resize: function (_1bc, _1bd) {
                $(_1bc)._outerWidth(_1bd)._outerHeight(22);
            }
        }
    });
    $.fn.datagrid.methods = {
        options: function (jq) {
            var _1be = $.data(jq[0], "datagrid").options;
            var _1bf = $.data(jq[0], "datagrid").panel.panel("options");
            var opts = $.extend(_1be, {
                width: _1bf.width,
                height: _1bf.height,
                closed: _1bf.closed,
                collapsed: _1bf.collapsed,
                minimized: _1bf.minimized,
                maximized: _1bf.maximized
            });
            return opts;
        }, setSelectionState: function (jq) {
            return jq.each(function () {
                _f9(this);
            });
        }, createStyleSheet: function (jq) {
            return _9(jq[0]);
        }, getPanel: function (jq) {
            return $.data(jq[0], "datagrid").panel;
        }, getPager: function (jq) {
            return $.data(jq[0], "datagrid").panel.children("div.datagrid-pager");
        }, getColumnFields: function (jq, _1c0) {
            return _73(jq[0], _1c0);
        }, getColumnOption: function (jq, _1c1) {
            return _74(jq[0], _1c1);
        }, resize: function (jq, _1c2) {
            return jq.each(function () {
                _1c(this, _1c2);
            });
        }, load: function (jq, _1c3) {
            return jq.each(function () {
                var opts = $(this).datagrid("options");
                if (typeof _1c3 == "string") {
                    opts.url = _1c3;
                    _1c3 = null;
                }
                opts.pageNumber = 1;
                var _1c4 = $(this).datagrid("getPager");
                _1c4.pagination("refresh", {pageNumber: 1});
                _ae(this, _1c3);
            });
        }, reload: function (jq, _1c5) {
            return jq.each(function () {
                var opts = $(this).datagrid("options");
                if (typeof _1c5 == "string") {
                    opts.url = _1c5;
                    _1c5 = null;
                }
                _ae(this, _1c5);
            });
        }, reloadFooter: function (jq, _1c6) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                var dc = $.data(this, "datagrid").dc;
                if (_1c6) {
                    $.data(this, "datagrid").footer = _1c6;
                }
                if (opts.showFooter) {
                    opts.view.renderFooter.call(opts.view, this, dc.footer2, false);
                    opts.view.renderFooter.call(opts.view, this, dc.footer1, true);
                    if (opts.view.onAfterRender) {
                        opts.view.onAfterRender.call(opts.view, this);
                    }
                    $(this).datagrid("fixRowHeight");
                }
            });
        }, loading: function (jq) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                $(this).datagrid("getPager").pagination("loading");
                if (opts.loadMsg) {
                    var _1c7 = $(this).datagrid("getPanel");
                    if (!_1c7.children("div.datagrid-mask").length) {
                        $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_1c7);
                        var msg = $("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_1c7);
                        msg._outerHeight(40);
                        msg.css({marginLeft: (-msg.outerWidth() / 2), lineHeight: (msg.height() + "px")});
                    }
                }
            });
        }, loaded: function (jq) {
            return jq.each(function () {
                $(this).datagrid("getPager").pagination("loaded");
                var _1c8 = $(this).datagrid("getPanel");
                _1c8.children("div.datagrid-mask-msg").remove();
                _1c8.children("div.datagrid-mask").remove();
            });
        }, fitColumns: function (jq) {
            return jq.each(function () {
                _b0(this);
            });
        }, fixColumnSize: function (jq, _1c9) {
            return jq.each(function () {
                _d1(this, _1c9);
            });
        }, fixRowHeight: function (jq, _1ca) {
            return jq.each(function () {
                _36(this, _1ca);
            });
        }, freezeRow: function (jq, _1cb) {
            return jq.each(function () {
                _47(this, _1cb);
            });
        }, autoSizeColumn: function (jq, _1cc) {
            return jq.each(function () {
                _c2(this, _1cc);
            });
        }, loadData: function (jq, data) {
            return jq.each(function () {
                _af(this, data);
                _175(this);
            });
        }, getData: function (jq) {
            return $.data(jq[0], "datagrid").data;
        }, getRows: function (jq) {
            return $.data(jq[0], "datagrid").data.rows;
        }, getFooterRows: function (jq) {
            return $.data(jq[0], "datagrid").footer;
        }, getRowIndex: function (jq, id) {
            return _102(jq[0], id);
        }, getChecked: function (jq) {
            return _108(jq[0]);
        }, getSelected: function (jq) {
            var rows = _105(jq[0]);
            return rows.length > 0 ? rows[0] : null;
        }, getSelections: function (jq) {
            return _105(jq[0]);
        }, clearSelections: function (jq) {
            return jq.each(function () {
                var _1cd = $.data(this, "datagrid");
                var _1ce = _1cd.selectedRows;
                var _1cf = _1cd.checkedRows;
                _1ce.splice(0, _1ce.length);
                _119(this);
                if (_1cd.options.checkOnSelect) {
                    _1cf.splice(0, _1cf.length);
                }
            });
        }, clearChecked: function (jq) {
            return jq.each(function () {
                var _1d0 = $.data(this, "datagrid");
                var _1d1 = _1d0.selectedRows;
                var _1d2 = _1d0.checkedRows;
                _1d2.splice(0, _1d2.length);
                _129(this);
                if (_1d0.options.selectOnCheck) {
                    _1d1.splice(0, _1d1.length);
                }
            });
        }, scrollTo: function (jq, _1d3) {
            return jq.each(function () {
                _10b(this, _1d3);
            });
        }, highlightRow: function (jq, _1d4) {
            return jq.each(function () {
                _8c(this, _1d4);
                _10b(this, _1d4);
            });
        }, selectAll: function (jq) {
            return jq.each(function () {
                _11e(this);
            });
        }, unselectAll: function (jq) {
            return jq.each(function () {
                _119(this);
            });
        }, selectRow: function (jq, _1d5) {
            return jq.each(function () {
                _95(this, _1d5);
            });
        }, selectRecord: function (jq, id) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                if (opts.idField) {
                    var _1d6 = _102(this, id);
                    if (_1d6 >= 0) {
                        $(this).datagrid("selectRow", _1d6);
                    }
                }
            });
        }, unselectRow: function (jq, _1d7) {
            return jq.each(function () {
                _96(this, _1d7);
            });
        }, checkRow: function (jq, _1d8) {
            return jq.each(function () {
                _92(this, _1d8);
            });
        }, uncheckRow: function (jq, _1d9) {
            return jq.each(function () {
                _93(this, _1d9);
            });
        }, checkAll: function (jq) {
            return jq.each(function () {
                _123(this);
            });
        }, uncheckAll: function (jq) {
            return jq.each(function () {
                _129(this);
            });
        }, beginEdit: function (jq, _1da) {
            return jq.each(function () {
                _13a(this, _1da);
            });
        }, endEdit: function (jq, _1db) {
            return jq.each(function () {
                _140(this, _1db, false);
            });
        }, cancelEdit: function (jq, _1dc) {
            return jq.each(function () {
                _140(this, _1dc, true);
            });
        }, getEditors: function (jq, _1dd) {
            return _14d(jq[0], _1dd);
        }, getEditor: function (jq, _1de) {
            return _151(jq[0], _1de);
        }, refreshRow: function (jq, _1df) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.refreshRow.call(opts.view, this, _1df);
            });
        }, validateRow: function (jq, _1e0) {
            return _13f(jq[0], _1e0);
        }, updateRow: function (jq, _1e1) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.updateRow.call(opts.view, this, _1e1.index, _1e1.row);
            });
        }, appendRow: function (jq, row) {
            return jq.each(function () {
                _172(this, row);
            });
        }, insertRow: function (jq, _1e2) {
            return jq.each(function () {
                _16e(this, _1e2);
            });
        }, deleteRow: function (jq, _1e3) {
            return jq.each(function () {
                _168(this, _1e3);
            });
        }, getChanges: function (jq, _1e4) {
            return _162(jq[0], _1e4);
        }, acceptChanges: function (jq) {
            return jq.each(function () {
                _179(this);
            });
        }, rejectChanges: function (jq) {
            return jq.each(function () {
                _17b(this);
            });
        }, mergeCells: function (jq, _1e5) {
            return jq.each(function () {
                _18e(this, _1e5);
            });
        }, showColumn: function (jq, _1e6) {
            return jq.each(function () {
                var _1e7 = $(this).datagrid("getPanel");
                _1e7.find("td[field=\"" + _1e6 + "\"]").show();
                $(this).datagrid("getColumnOption", _1e6).hidden = false;
                $(this).datagrid("fitColumns");
            });
        }, hideColumn: function (jq, _1e8) {
            return jq.each(function () {
                var _1e9 = $(this).datagrid("getPanel");
                _1e9.find("td[field=\"" + _1e8 + "\"]").hide();
                $(this).datagrid("getColumnOption", _1e8).hidden = true;
                $(this).datagrid("fitColumns");
            });
        }, sort: function (jq, _1ea) {
            return jq.each(function () {
                _a2(this, _1ea);
            });
        }
    };
    $.fn.datagrid.parseOptions = function (_1eb) {
        var t = $(_1eb);
        return $.extend({}, $.fn.panel.parseOptions(_1eb), $.parser.parseOptions(_1eb, ["url", "toolbar", "idField", "sortName", "sortOrder", "pagePosition", "resizeHandle", {
            sharedStyleSheet: "boolean",
            fitColumns: "boolean",
            autoRowHeight: "boolean",
            striped: "boolean",
            nowrap: "boolean"
        }, {
            rownumbers: "boolean",
            singleSelect: "boolean",
            ctrlSelect: "boolean",
            checkOnSelect: "boolean",
            selectOnCheck: "boolean"
        }, {pagination: "boolean", pageSize: "number", pageNumber: "number"}, {
            multiSort: "boolean",
            remoteSort: "boolean",
            showHeader: "boolean",
            showFooter: "boolean"
        }, {scrollbarSize: "number"}]), {
            pageList: (t.attr("pageList") ? eval(t.attr("pageList")) : undefined),
            loadMsg: (t.attr("loadMsg") != undefined ? t.attr("loadMsg") : undefined),
            rowStyler: (t.attr("rowStyler") ? eval(t.attr("rowStyler")) : undefined)
        });
    };
    $.fn.datagrid.parseData = function (_1ec) {
        var t = $(_1ec);
        var data = {total: 0, rows: []};
        var _1ed = t.datagrid("getColumnFields", true).concat(t.datagrid("getColumnFields", false));
        t.find("tbody tr").each(function () {
            data.total++;
            var row = {};
            $.extend(row, $.parser.parseOptions(this, ["iconCls", "state"]));
            for (var i = 0; i < _1ed.length; i++) {
                row[_1ed[i]] = $(this).find("td:eq(" + i + ")").html();
            }
            data.rows.push(row);
        });
        return data;
    };
    var _1ee = {
        render: function (_1ef, _1f0, _1f1) {
            var _1f2 = $.data(_1ef, "datagrid");
            var opts = _1f2.options;
            var rows = _1f2.data.rows;
            var _1f3 = $(_1ef).datagrid("getColumnFields", _1f1);
            if (_1f1) {
                if (!(opts.rownumbers || (opts.frozenColumns && opts.frozenColumns.length))) {
                    return;
                }
            }
            var _1f4 = ["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                var css = opts.rowStyler ? opts.rowStyler.call(_1ef, i, rows[i]) : "";
                var _1f5 = "";
                var _1f6 = "";
                if (typeof css == "string") {
                    _1f6 = css;
                } else {
                    if (css) {
                        _1f5 = css["class"] || "";
                        _1f6 = css["style"] || "";
                    }
                }
                var cls = "class=\"datagrid-row " + (i % 2 && opts.striped ? "datagrid-row-alt " : " ") + _1f5 + "\"";
                var _1f7 = _1f6 ? "style=\"" + _1f6 + "\"" : "";
                var _1f8 = _1f2.rowIdPrefix + "-" + (_1f1 ? 1 : 2) + "-" + i;
                _1f4.push("<tr id=\"" + _1f8 + "\" datagrid-row-index=\"" + i + "\" " + cls + " " + _1f7 + ">");
                _1f4.push(this.renderRow.call(this, _1ef, _1f3, _1f1, i, rows[i]));
                _1f4.push("</tr>");
            }
            _1f4.push("</tbody></table>");
            $(_1f0).html(_1f4.join(""));
        }, renderFooter: function (_1f9, _1fa, _1fb) {
            var opts = $.data(_1f9, "datagrid").options;
            var rows = $.data(_1f9, "datagrid").footer || [];
            var _1fc = $(_1f9).datagrid("getColumnFields", _1fb);
            var _1fd = ["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                _1fd.push("<tr class=\"datagrid-row\" datagrid-row-index=\"" + i + "\">");
                _1fd.push(this.renderRow.call(this, _1f9, _1fc, _1fb, i, rows[i]));
                _1fd.push("</tr>");
            }
            _1fd.push("</tbody></table>");
            $(_1fa).html(_1fd.join(""));
        }, renderRow: function (_1fe, _1ff, _200, _201, _202) {
            var opts = $.data(_1fe, "datagrid").options;
            var cc = [];
            if (_200 && opts.rownumbers) {
                var _203 = _201 + 1;
                if (opts.pagination) {
                    _203 += (opts.pageNumber - 1) * opts.pageSize;
                }
                cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">" + _203 + "</div></td>");
            }
            for (var i = 0; i < _1ff.length; i++) {
                var _204 = _1ff[i];
                var col = $(_1fe).datagrid("getColumnOption", _204);
                if (col) {
                    var _205 = _202[_204];
                    var css = col.styler ? (col.styler(_205, _202, _201) || "") : "";
                    var _206 = "";
                    var _207 = "";
                    if (typeof css == "string") {
                        _207 = css;
                    } else {
                        if (css) {
                            _206 = css["class"] || "";
                            _207 = css["style"] || "";
                        }
                    }
                    var cls = _206 ? "class=\"" + _206 + "\"" : "";
                    var _208 = col.hidden ? "style=\"display:none;" + _207 + "\"" : (_207 ? "style=\"" + _207 + "\"" : "");
                    cc.push("<td field=\"" + _204 + "\" " + cls + " " + _208 + ">");
                    var _208 = "";
                    if (!col.checkbox) {
                        if (col.align) {
                            _208 += "text-align:" + col.align + ";";
                        }
                        if (!opts.nowrap) {
                            _208 += "white-space:normal;height:auto;";
                        } else {
                            if (opts.autoRowHeight) {
                                _208 += "height:auto;";
                            }
                        }
                    }
                    cc.push("<div style=\"" + _208 + "\" ");
                    cc.push(col.checkbox ? "class=\"datagrid-cell-check\"" : "class=\"datagrid-cell " + col.cellClass + "\"");
                    cc.push(">");
                    if (col.checkbox) {
                        cc.push("<input type=\"checkbox\" " + (_202.checked ? "checked=\"checked\"" : ""));
                        cc.push(" name=\"" + _204 + "\" value=\"" + (_205 != undefined ? _205 : "") + "\">");
                    } else {
                        if (col.formatter) {
                            cc.push(col.formatter(_205, _202, _201));
                        } else {
                            cc.push(_205);
                        }
                    }
                    cc.push("</div>");
                    cc.push("</td>");
                }
            }
            return cc.join("");
        }, refreshRow: function (_209, _20a) {
            this.updateRow.call(this, _209, _20a, {});
        }, updateRow: function (_20b, _20c, row) {
            var opts = $.data(_20b, "datagrid").options;
            var rows = $(_20b).datagrid("getRows");
            var _20d = _20e(_20c);
            $.extend(rows[_20c], row);
            var _20f = _20e(_20c);
            var _210 = _20d.c;
            var _211 = _20f.s;
            var _212 = "datagrid-row " + (_20c % 2 && opts.striped ? "datagrid-row-alt " : " ") + _20f.c;

            function _20e(_213) {
                var css = opts.rowStyler ? opts.rowStyler.call(_20b, _213, rows[_213]) : "";
                var _214 = "";
                var _215 = "";
                if (typeof css == "string") {
                    _215 = css;
                } else {
                    if (css) {
                        _214 = css["class"] || "";
                        _215 = css["style"] || "";
                    }
                }
                return {c: _214, s: _215};
            };
            function _216(_217) {
                var _218 = $(_20b).datagrid("getColumnFields", _217);
                var tr = opts.finder.getTr(_20b, _20c, "body", (_217 ? 1 : 2));
                var _219 = tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
                tr.html(this.renderRow.call(this, _20b, _218, _217, _20c, rows[_20c]));
                tr.attr("style", _211).removeClass(_210).addClass(_212);
                if (_219) {
                    tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true);
                }
            };
            _216.call(this, true);
            _216.call(this, false);
            $(_20b).datagrid("fixRowHeight", _20c);
        }, insertRow: function (_21a, _21b, row) {
            var _21c = $.data(_21a, "datagrid");
            var opts = _21c.options;
            var dc = _21c.dc;
            var data = _21c.data;
            if (_21b == undefined || _21b == null) {
                _21b = data.rows.length;
            }
            if (_21b > data.rows.length) {
                _21b = data.rows.length;
            }
            function _21d(_21e) {
                var _21f = _21e ? 1 : 2;
                for (var i = data.rows.length - 1; i >= _21b; i--) {
                    var tr = opts.finder.getTr(_21a, i, "body", _21f);
                    tr.attr("datagrid-row-index", i + 1);
                    tr.attr("id", _21c.rowIdPrefix + "-" + _21f + "-" + (i + 1));
                    if (_21e && opts.rownumbers) {
                        var _220 = i + 2;
                        if (opts.pagination) {
                            _220 += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_220);
                    }
                    if (opts.striped) {
                        tr.removeClass("datagrid-row-alt").addClass((i + 1) % 2 ? "datagrid-row-alt" : "");
                    }
                }
            };
            function _221(_222) {
                var _223 = _222 ? 1 : 2;
                var _224 = $(_21a).datagrid("getColumnFields", _222);
                var _225 = _21c.rowIdPrefix + "-" + _223 + "-" + _21b;
                var tr = "<tr id=\"" + _225 + "\" class=\"datagrid-row\" datagrid-row-index=\"" + _21b + "\"></tr>";
                if (_21b >= data.rows.length) {
                    if (data.rows.length) {
                        opts.finder.getTr(_21a, "", "last", _223).after(tr);
                    } else {
                        var cc = _222 ? dc.body1 : dc.body2;
                        cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>" + tr + "</tbody></table>");
                    }
                } else {
                    opts.finder.getTr(_21a, _21b + 1, "body", _223).before(tr);
                }
            };
            _21d.call(this, true);
            _21d.call(this, false);
            _221.call(this, true);
            _221.call(this, false);
            data.total += 1;
            data.rows.splice(_21b, 0, row);
            this.refreshRow.call(this, _21a, _21b);
        }, deleteRow: function (_226, _227) {
            var _228 = $.data(_226, "datagrid");
            var opts = _228.options;
            var data = _228.data;

            function _229(_22a) {
                var _22b = _22a ? 1 : 2;
                for (var i = _227 + 1; i < data.rows.length; i++) {
                    var tr = opts.finder.getTr(_226, i, "body", _22b);
                    tr.attr("datagrid-row-index", i - 1);
                    tr.attr("id", _228.rowIdPrefix + "-" + _22b + "-" + (i - 1));
                    if (_22a && opts.rownumbers) {
                        var _22c = i;
                        if (opts.pagination) {
                            _22c += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_22c);
                    }
                    if (opts.striped) {
                        tr.removeClass("datagrid-row-alt").addClass((i - 1) % 2 ? "datagrid-row-alt" : "");
                    }
                }
            };
            opts.finder.getTr(_226, _227).remove();
            _229.call(this, true);
            _229.call(this, false);
            data.total -= 1;
            data.rows.splice(_227, 1);
        }, onBeforeRender: function (_22d, rows) {
        }, onAfterRender: function (_22e) {
            var opts = $.data(_22e, "datagrid").options;
            if (opts.showFooter) {
                var _22f = $(_22e).datagrid("getPanel").find("div.datagrid-footer");
                _22f.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility", "hidden");
            }
        }
    };
    $.fn.datagrid.defaults = $.extend({}, $.fn.panel.defaults, {
        sharedStyleSheet: false,
        frozenColumns: undefined,
        columns: undefined,
        fitColumns: false,
        resizeHandle: "right",
        autoRowHeight: true,
        toolbar: null,
        striped: false,
        method: "post",
        nowrap: true,
        idField: null,
        url: null,
        data: null,
        loadMsg: "Processing, please wait ...",
        rownumbers: false,
        singleSelect: false,
        ctrlSelect: false,
        selectOnCheck: true,
        checkOnSelect: true,
        pagination: false,
        pagePosition: "bottom",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 20, 30, 40, 50],
        queryParams: {},
        sortName: null,
        sortOrder: "asc",
        multiSort: false,
        remoteSort: true,
        showHeader: true,
        showFooter: false,
        scrollbarSize: 18,
        rowEvents: {mouseover: _85(true), mouseout: _85(false), click: _8e, dblclick: _99, contextmenu: _9e},
        rowStyler: function (_230, _231) {
        },
        loader: function (_232, _233, _234) {
            var opts = $(this).datagrid("options");
            if (!opts.url) {
                return false;
            }
            $.ajax({
                type: opts.method, url: opts.url, data: _232, dataType: "json", success: function (data) {
                    _233(data);
                }, error: function () {
                    _234.apply(this, arguments);
                }
            });
        },
        loadFilter: function (data) {
            if (typeof data.length == "number" && typeof data.splice == "function") {
                return {total: data.length, rows: data};
            } else {
                return data;
            }
        },
        editors: _1a5,
        finder: {
            getTr: function (_235, _236, type, _237) {
                type = type || "body";
                _237 = _237 || 0;
                var _238 = $.data(_235, "datagrid");
                var dc = _238.dc;
                var opts = _238.options;
                if (_237 == 0) {
                    var tr1 = opts.finder.getTr(_235, _236, type, 1);
                    var tr2 = opts.finder.getTr(_235, _236, type, 2);
                    return tr1.add(tr2);
                } else {
                    if (type == "body") {
                        var tr = $("#" + _238.rowIdPrefix + "-" + _237 + "-" + _236);
                        if (!tr.length) {
                            tr = (_237 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index=" + _236 + "]");
                        }
                        return tr;
                    } else {
                        if (type == "footer") {
                            return (_237 == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index=" + _236 + "]");
                        } else {
                            if (type == "selected") {
                                return (_237 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-selected");
                            } else {
                                if (type == "highlight") {
                                    return (_237 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-over");
                                } else {
                                    if (type == "checked") {
                                        return (_237 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-checked");
                                    } else {
                                        if (type == "editing") {
                                            return (_237 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-editing");
                                        } else {
                                            if (type == "last") {
                                                return (_237 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
                                            } else {
                                                if (type == "allbody") {
                                                    return (_237 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]");
                                                } else {
                                                    if (type == "allfooter") {
                                                        return (_237 == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }, getRow: function (_239, p) {
                var _23a = (typeof p == "object") ? p.attr("datagrid-row-index") : p;
                return $.data(_239, "datagrid").data.rows[parseInt(_23a)];
            }, getRows: function (_23b) {
                return $(_23b).datagrid("getRows");
            }
        },
        view: _1ee,
        onBeforeLoad: function (_23c) {
        },
        onLoadSuccess: function () {
        },
        onLoadError: function () {
        },
        onClickRow: function (_23d, _23e) {
        },
        onDblClickRow: function (_23f, _240) {
        },
        onClickCell: function (_241, _242, _243) {
        },
        onDblClickCell: function (_244, _245, _246) {
        },
        onBeforeSortColumn: function (sort, _247) {
        },
        onSortColumn: function (sort, _248) {
        },
        onResizeColumn: function (_249, _24a) {
        },
        onBeforeSelect: function (_24b, _24c) {
        },
        onSelect: function (_24d, _24e) {
        },
        onBeforeUnselect: function (_24f, _250) {
        },
        onUnselect: function (_251, _252) {
        },
        onSelectAll: function (rows) {
        },
        onUnselectAll: function (rows) {
        },
        onBeforeCheck: function (_253, _254) {
        },
        onCheck: function (_255, _256) {
        },
        onBeforeUncheck: function (_257, _258) {
        },
        onUncheck: function (_259, _25a) {
        },
        onCheckAll: function (rows) {
        },
        onUncheckAll: function (rows) {
        },
        onBeforeEdit: function (_25b, _25c) {
        },
        onBeginEdit: function (_25d, _25e) {
        },
        onEndEdit: function (_25f, _260, _261) {
        },
        onAfterEdit: function (_262, _263, _264) {
        },
        onCancelEdit: function (_265, _266) {
        },
        onHeaderContextMenu: function (e, _267) {
        },
        onRowContextMenu: function (e, _268, _269) {
        }
    });
})(jQuery);

